package com.user.chris.aopconfig;


import com.common.chris.entity.BaseVO;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * @author wujf
 * @date 2021/10/26
 */
@Aspect
@Component
public class CheckAop {

    @Before("execution(public * com.user.chris.controller.*.*(..))")
    public void doBefore(JoinPoint joinPoint) {
        // 获取参数
        Object[] args = joinPoint.getArgs();
        for (Object arg : args) {
            if (arg instanceof BaseVO) {
                ((BaseVO) arg).validate();
            }
        }
    }

}
